#include "SList.h"

void SListTest1()
{
	SLTNode* plist = NULL;

	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);

	SLTPrint(plist);
	SLTPopBack(&plist);
	SLTPrint(plist);

	SLTPopBack(&plist);
	SLTPrint(plist);

	SLTPopBack(&plist);
	SLTPrint(plist);

	SLTPopBack(&plist);
	SLTPopBack(&plist);
	SLTPopBack(&plist);

	SLTPrint(plist);
	SLTPrint(plist);
	SLTPrint(plist);

}

void SListTest2()
{
	SLTNode* plist = NULL;

	SLTPushFront(&plist, 1);
	SLTPushFront(&plist, 2);
	SLTPushFront(&plist, 3);
	SLTPushFront(&plist, 4);

	SLTPrint(plist);
	SLTPopFront(&plist);
	SLTPrint(plist);

	SLTPopFront(&plist);
	SLTPrint(plist);

	SLTPopFront(&plist);
	SLTPrint(plist);

	SLTPopFront(&plist);
	SLTPrint(plist);
	SLTPopFront(&plist);
	SLTPrint(plist);

}

void SListTest3()
{
	SLTNode* plist = NULL;

	SLTEraseAfter(plist);
	SLTPrint(plist);
	SLTPushFront(&plist, 1);
	SLTPushFront(&plist, 2);

	SLTPushFront(&plist, 3);
	SLTPushFront(&plist, 4);

	SLTPrint(plist);
	SLTInsertAfter(SLTFind(plist, 2), 5);
	SLTPrint(plist);
	
	SLTInsertAfter(SLTFind(plist, 3), 7);
	SLTPrint(plist);
	
	SLTInsertAfter(SLTFind(plist, 4), 10);
	SLTPrint(plist);
	
	SLTInsertAfter(SLTFind(plist, 10), 25);
	SLTPrint(plist);

	SLTInsertAfter(SLTFind(plist, 1), 15);
	SLTPrint(plist);

	SLTEraseAfter(plist);
	SLTPrint(plist);

	SLTEraseAfter(SLTFind(plist, 1));
	SLTPrint(plist);

	SLTEraseAfter(SLTFind(plist, 1));
	SLTPrint(plist);

	SLTEraseAfter(SLTFind(plist, 3));
	SLTPrint(plist);

}

void SListTest4()
{
	SLTNode* plist = NULL;

	SLTPushFront(&plist, 1);
	SLTPushFront(&plist, 2);

	SLTPushFront(&plist, 3);
	SLTPushFront(&plist, 4);

	SLTPrint(plist);
	SLTInsert(&plist, plist, 15);
	SLTPrint(plist);

	SLTInsert(&plist, SLTFind(plist, 2), 40);
	SLTPrint(plist);

	SLTInsert(&plist, SLTFind(plist, 1), 100);
	SLTPrint(plist);

	SLTErase(&plist, plist);
	SLTPrint(plist);

	SLTErase(&plist, SLTFind(plist, 1));
	SLTPrint(plist);

	SLTErase(&plist, SLTFind(plist, 40));
	SLTPrint(plist);
	SLTErase(&plist, plist);
	SLTPrint(plist);

	SLTErase(&plist, plist);
	SLTPrint(plist);

	SLTErase(&plist, plist);
	SLTPrint(plist);

	SLTErase(&plist, plist);
	SLTPrint(plist);

	SLTErase(&plist, plist);
	SLTErase(&plist, plist);
	SLTPrint(plist);

	SLTErase(&plist, plist);
	SLTErase(&plist, plist);
	SLTPrint(plist);


}

int main()
{
	SListTest4();

	return 0;
}